<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta name="language" content="en" />

	<!-- blueprint CSS framework -->
	<link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/css/screen.css" media="screen, projection" />
	<link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/css/print.css" media="print" />
	<!--[if lt IE 8]>
	<link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/css/ie.css" media="screen, projection" />
	<![endif]-->

	<link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/css/main.css" />
	<link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/css/form.css" />

	<title><?php echo CHtml::encode($this->pageTitle); ?></title>
 <script type="text/javascript">
                            $(document).ready(function(){
                                var searchBoxDefault = "City";
                                var searchBox = $("#location");
                                searchBox.attr("value", searchBoxDefault);
                                searchBox.focus(function(){
                                    if($(this).attr("value") == searchBoxDefault) $(this).attr("value", "");
                                });
                                searchBox.blur(function(){
                                    if($(this).attr("value") == "") $(this).attr("value", searchBoxDefault);
                                });
                            });
                        </script>
</head>
<body>

<FORM action="" method="post">

<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'user-form',
	'enableAjaxValidation'=>false,
	'enableClientValidation'=>true,
)); ?>
	<?php //echo $form->errorSummary($model); ?>
</BR>
    <P>
<LABEL for="lastname">city: </LABEL>
             <? //<INPUT type="hidden" id="city" name="city" id="loc_id"></BR></BR> ?>
			 <input type="hidden" name="loc_id" id="loc_id"/> 
			  <?php 	
	 						$this->widget('zii.widgets.jui.CJuiAutoComplete', array(
							'name'=>'location',
							'value'=>'Location',
						//	'source'=>$people, // <- use this for pre-set array of values
							'source'=>Yii::app()->createUrl('site/getLocation'),// <- path to controller which returns dynamic data
							// additional javascript options for the autocomplete plugin
							'options'=>array(
								'minLength'=>'1', // min chars to start search
								'select'=>'js:function(event, ui) {
								$("#loc_id").val(ui.item.id); 
								$("#loc_type").val(ui.item.category);
								console.log(ui.item.id +":"+ui.item.value); }'
							),
							'htmlOptions'=>array(
								'id'=>'location',
								'rel'=>'val',
								'class'=>'location',
								'onfocus'=>'clearText(this)',
								'onblur'=>'clearText(this)',
							),
						)); ?>
    <LABEL for="email">email: </LABEL>
              <INPUT type="text" id="email" name="email"><BR>

  
    <INPUT type="submit" value="submit" name="submit"> 
	<INPUT type="submit" value="skip" name="skip"> 
    </P>
	
	<?php $this->endWidget(); ?>
	
 </FORM>


</body>